m01zaf

m01zaf © Numerical Algorithms Group, 2002.

Purpose

M01ZAF Invert a permutation

Synopsis

[iperm,ifail] = m01zaf(iperm<,ifail>)

Description

 
 There are two common ways of describing a permutation using an 
 integer vector IPERM. The first uses ranks: IPERM(i) holds the 
 position to which the ith data element should be moved in order 
 to sort the data; in other words its rank in the sorted order. 
 The second uses indices: IPERM(i) holds the current position of 
 the data element which would occur in ith position in sorted 
 order. For example, given the values
 
        3.5    5.9    2.9    0.5
 
 to be sorted in ascending order, the ranks would be
 
        3      4      2      1
 
 and the indices would be
 
        4      3      1      2
 
 The M01D- routines generate ranks, and the M01E- routines require
 ranks to be supplied to specify the re-ordering. However if it is
 desired simply to refer to the data in sorted order without 
 actually re-ordering them, indices are more convenient than ranks.
 
 M01ZAF can be used to convert ranks to indices, or indices to 
 ranks, as the two permutations are inverses of one another.
 

Parameters

m01zaf

Required Input Arguments:

iperm (:)                             integer

Optional Input Arguments:                       <Default>

ifail                                 integer  -1

Output Arguments:

iperm (:)                             integer
ifail                                 integer